package com.mangu.dao;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class SqlSessionUtil {

	private static final String PATH="/mybatis.xml";
	
	private static SqlSessionFactory SQL_SESSION_FACTORY=build();
	
	private static SqlSessionFactory build() {
		return new SqlSessionFactoryBuilder()
				.build(SqlSessionUtil.class.getResourceAsStream(PATH));
	}
	
	public static SqlSession getSession() {
		SqlSession session=SQL_SESSION_FACTORY.openSession();
		return session;
	}
}
